package com.xuhuan.thread.study2;

/**
 * @author huan.xu
 * @date 2021/9/29 15:56
 * @description 守护线程，上帝保有着你
 */
public class DeamonThreadDemo {

    public static void main(String[] args) {
        Thread god = new Thread(() -> {
            while (true) {
                System.out.println("上帝守护者你");
            }
        });

        god.setDaemon(true);
        god.start();

        Thread people = new Thread(() -> {
            for (int i = 0; i < 36500; i++) {
                System.out.println("人们开心的活着");
            }
            System.out.println("=====再见！世界！=====");
        });
        people.start();
    }
}
